package tgt

import (
	"golang.org/x/crypto/ssh"
	"time"
)

type ErrorResponse struct {
	MessageType  string `json:"messageType"`
	ErrorMessage string `json:"errorMessage"`
	RawMessage   string `json:"rawMessage"`
	Code         int    `json:"code"`
}

type SuccessResponse struct {
	MessageType    string        `json:"messageType"`
	SuccessMessage string        `json:"successMessage"`
	Code           int           `json:"code"`
	RawMessage     string        `json:"rawMessage"`
	AnsibleResult  AnsibleResult `json:"ansibleResult"`
}

type ManagerHostInfo struct {
	Method      string `json:"method"`
	GatewayName string `json:"gatewayName"`
	HostAddress string `json:"hostAddress"`
}

type HostInfo struct {
	Address string `json:"address"`
}

type TargetInfo struct {
	TargetMethod string `json:"targetMethod"`
	HostAddress  string `json:"hostAddress"`
	TargetID     string `json:"targetID"`
}

type TargetIPInfo struct {
	HostAddress string `json:"hostAddress"`
	TargetID    string `json:"targetID"`
	IPAddress   string `json:"ipAddress"`
}

type TargetUserInfo struct {
	HostAddress string `json:"hostAddress"`
	TargetID    string `json:"targetID"`
	Username    string `json:"username"`
	Password    string `json:"password"`
}

type LUNInfo struct {
	HostAddress string `json:"hostAddress"`
	TargetID    string `json:"targetID"`
	LunID       string `json:"lunID"`
	LogicalID   string `json:"logicalID"`
	LunSize     string `json:"lunSize"`
}

type AnsibleResult struct {
	Ok          int `json:"Ok"`
	Changed     int `json:"Changed"`
	Unreachable int `json:"Unreachable"`
	Failed      int `json:"Failed"`
}

type StatusResult struct {
	Host        string `json:"Host"`
	ActiveState string `json:"ActiveState"`
	SubState    string `json:"SubState"`
	Services    string `json:"Services"`
	LoadError   string `json:"LoadError"`
}

type GatewayListResult struct {
	GatewayList []GatewayInfo `json:"gatewayList"`
}

type QueryTargetRequest struct {
	Host string `json:"host"`
}

type QueryTargetInfoRequest struct {
	Host     string `json:"host"`
	TargetID string `json:"targetID"`
}

type SSHInfo struct {
	Network     string
	HostAddress string
	Username    string
	Password    string
	SSHConfig   *ssh.ClientConfig
}

type GatewayInfo struct {
	Name       string
	Host       string
	CreateTime time.Time
	Active     int
}

type TargetDBInfo struct {
	Host       string
	TargetID   int
	CreateTime time.Time
}

type LUNDBInfo struct {
	Host       string
	TargetID   int
	LunID      int
	LogicalID  int
	LunSize    int
	CreateTime time.Time
}

type TargetIPDBInfo struct {
	Host       string
	TargetID   int
	IPAddress  string
	CreateTime time.Time
}

type TargetUserDBInfo struct {
	Host       string
	TargetID   int
	Username   string
	Password   string
	CreateTime time.Time
}
